import { BasePagesResponseData, BaseResponseData } from "@renderer/interface/baseData";
import { ClassForm, ClassInfo, ClassItem, ClassSearchForm, WorkItem } from "@renderer/interface/class";
import http from "@renderer/utils/request";

/**
 * 获取班级分页
 * @param data 搜索班级表单
 * @returns 
 */
export const getClassPageApi = (data?: ClassSearchForm) =>
	http.get<BasePagesResponseData<ClassItem>>('/crm/teach/class/page', data)

/**
 * 导出班级
 * @param data 搜索班级表单
 * @returns 
 */
export const getClassExportApi = (data: ClassSearchForm) =>
	http.get<BaseResponseData<null>>('/crm/teach/class/export', data)

/**
 * 获取班级详情
 * @param id 班级id
 * @returns 
 */
export const getClassGetApi = (id: string) =>
	http.get<BaseResponseData<ClassInfo>>(`/crm/teach/class/get/${id}`)

/**
 * 新增或修改班级
 * @param data 班级表单
 * @returns 
 */
export const postClassAOUApi = (data: ClassForm) =>
	http.post<BaseResponseData<null>>(`/crm/teach/class/${data.id ? 'update' : 'add'}`, data)

/**
 * 删除某一班级
 * @param id 
 * @returns 
 */
export const getClassDelApi = (id: string) =>
	http.get<BaseResponseData<null>>(`/crm/teach/class/delete/${id}`)

/**
 * 查询排课
 * @param data 
 * @returns 
 */
export const getWorkGetApi = (data: { classId: string, teached?: string }) =>
	http.get<BaseResponseData<WorkItem[]>>('/crm/recruit/work/get', data)

/**
 * 新增或修改排课
 * @param data 
 * @returns 
 */
export const postWorkAOUApi = (data: WorkItem[]) =>
	http.post<BaseResponseData<null>>('/crm/recruit/work/save', data)